#include "threadeg.h"
#include <QThread>
#include "mysingleton.h"

threadEg::threadEg(QObject* parent) : bRun(true)
{
    qRegisterMetaType<struct egEmit>("egEmitType");
}

threadEg::~threadEg()
{
    m_Mutex.lock();
    bRun = false;
    m_Mutex.unlock();
}

void threadEg::doWork()
{
    while(bRun)
    {
        QThread::msleep(1000);
        struct egEmit e;

        emit recvData(e);
    }
}

threadEg* threadEg::GetInstance()
{
    static MySingleton<threadEg> sh;

    return sh.get();
}
